package com.j1903.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class CORSConfig implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
//        匹配所有访问路径
       registry.addMapping("/**")
               .allowedOrigins("null","http://127.0.0.1:8848")
               .allowedHeaders("*")
               .allowedMethods("POST","GET")
               .allowCredentials(true)
               .maxAge(3600);
    }
}
